<template>
  <div>
    <a-card :bordered="false" title="数据类型">
      <dic-panel @select-row-change="selectRowChange"/>
    </a-card>
    <a-divider style="margin: 0 0 16px;"/>
    <a-card :bordered="false" :title="(dictLabel === '' ? '所有' : dictLabel) + '的数据子项'">
      <dic-item-panel :dict-code="dictCode" :dict-label="dictLabel"/>
    </a-card>
  </div>
</template>

<script>
import DicPanel from './modules/DictPanel'
import DicItemPanel from './modules/DictItemPanel'
export default {
  name: 'DictionaryList',
  components: { DicPanel, DicItemPanel },
  data () {
    return {
      dictCode: [],
      dictLabel: ''
    }
  },
  methods: {
    selectRowChange (codes, rows) {
      const label = []
      this.dictCode = codes
      rows.forEach(row => {
        label.push(row.name)
      })
      this.dictLabel = label.join('、')
    }
  }
}
</script>

<style scoped>

</style>
